#include <cstdio>
#include <algorithm>
using namespace std;

int x, y, com = 0;

int main()
{
	freopen("init.in", "r", stdin);
	scanf("%d%d", &x, &y);

	for (int p = x; p < y; p++)
		for (int q = p + 1; q <= y; q++)
			if (__gcd(p, q) == x && p * q / __gcd(p, q) == y)
				com++;

	printf("%d\n", com * 2);
	return 0;
}